package sg.edu.nus.iss.vmcs.controller;

/*
 * Copyright 2003 ISS.
 * The contents contained in this document may not be reproduced in any
 * form or by any means, without the written permission of ISS, other
 * than for the purpose for which it has been supplied.
 *
 */

import java.io.*;

import sg.edu.nus.iss.vmcs.entity.Brand;
import sg.edu.nus.iss.vmcs.entity.BrandDrinkStore;
import sg.edu.nus.iss.vmcs.entity.BrandStore;
import sg.edu.nus.iss.vmcs.entity.BrandStoreItem;
import sg.edu.nus.iss.vmcs.entity.CashStore;
import sg.edu.nus.iss.vmcs.entity.CashStoreItem;
import sg.edu.nus.iss.vmcs.entity.Coin;
import sg.edu.nus.iss.vmcs.entity.Store1;
import sg.edu.nus.iss.vmcs.entity.StoreItem;
import sg.edu.nus.iss.vmcs.entity.StoreObject;
import sg.edu.nus.iss.vmcs.util.PropertyLoader;

/**
 *
 *
 * @version 1.0 5/07/2003
 * @author Olivo Miotto, Pang Ping Li
 */

public abstract class StoreController1 {

	protected Store1 cStore = null;
	private String modelName = "default";
	
	public String getModelName(){
		return this.modelName;
	}

	protected void setModelName(String modelName){
		this.modelName=modelName;
	}
	
	protected void setStore(Store1 store){
		System.out.println("Store "+store);
		this.cStore = store;
	}
	public int getStoreSize(){
		return cStore.getStoreSize();
	}

	public StoreItem[] getItems(){
		return cStore.getItems();
	}
	
	public StoreItem getItem(int itemIndex){
		return cStore.getItem(itemIndex);
	}
	
	protected abstract void init(String modelName);
	
	public void updateItem(StoreItem storeItem){
		cStore.updateItem(storeItem);
		cStore.storeRecords();
	}
	
	public StoreItem findStoreItem(StoreObject object){
		return cStore.findStoreItem(object);
	}
}
